import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

import home from '@/components/home'
import category from '@/components/category'
import cart from '@/components/cart'
import find from '@/components/find'
import user from '@/components/user'

import productDetail from '@/components/product/detail'
import confirmOrder from '@/components/order/confirmOrder'

import addProduct from '@/components/manage/addProduct'
import addCategory from '@/components/manage/addCategory'
import productList from '@/components/manage/productList'
import orderList from '@/components/manage/orderList'
import categoryList from '@/components/manage/categoryList'
import myUpload from '@/components/manage/myUpload'
import manage from '@/components/manage/manage'

import login from '@/components/user/login'
import register from '@/components/user/register'
import setter from '@/components/user/setter'
import repassword from '@/components/user/repassword'
import usermsg from '@/components/user/usermsg'
import shipping from '@/components/user/shipping'
import addShipping from '@/components/user/addShipping'
import uploadPhoto from '@/components/user/uploadPhoto'
import order from '@/components/user/order'

//测试组件
import Hello from '@/components/test/Hello'
import Hi from '@/components/test/Hi'
import Home from '@/components/test/Home'

export default new Router({
  routes: [
    {
      path: '/',redirect: '/home'
    },
    {
      path: '/home',
      name: 'home',
      component: home
    },
    {
      path: '/category',
      name: 'category',
      component: category
    },
    {
      path: '/cart',
      name: 'cart',
      component: cart
    },
    {
      path: '/find',
      name: 'find',
      component: find
    },
    {
      path: '/user',
      name: 'user',
      component: user
    },
    {
      path: '/user/login',
      name: 'login',
      component: login
    },
    {
      path: '/user/repassword',
      name: 'repassword',
      component: repassword
    },
    {
      path: '/user/usermsg',
      name: 'usermsg',
      component: usermsg
    },
    {
      path: '/user/shipping',
      name: 'shipping',
      component: shipping
    },
    {
      path: '/user/addShipping',
      name: 'addShipping',
      component: addShipping
    },
    {
      path: '/user/uploadPhoto',
      name: 'uploadPhoto',
      component: uploadPhoto
    },
    {
      path: '/user/setter',
      name: 'setter',
      component: setter
    },
    {
      path: '/user/register',
      name: 'register',
      component: register
    },
    {
      path: '/user/manage',
      name: 'manage',
      component: manage
    },
    {
      path: '/user/order',
      name: 'order',
      component: order
    },
    {
      path: '/manage/addProduct',
      name: 'addProduct',
      component: addProduct
    },
    {
      path: '/manage/addCategory',
      name: 'addCategory',
      component: addCategory
    },
    {
      path: '/manage/productList',
      name: 'productList',
      component: productList
    },
    {
      path: '/manage/orderList',
      name: 'orderList',
      component: orderList
    },
    {
      path: '/manage/categoryList',
      name: 'categoryList',
      component: categoryList
    },
    {
      path: '/manage/myUpload',
      name: 'myUpload',
      component: myUpload
    },
    {
      path: '/product/productDetail',
      name: 'productDetail',
      component: productDetail
    },
    {
      path: '/order/confirmOrder',
      name: 'confirmOrder',
      component: confirmOrder
    },
    {
      path: '/test/Hello',
      name: 'Hello',
      component: Hello
      //嵌套路由演示
      // children: [
      //   {
      //     path: '',
      //     name: 'Home',
      //     component: Home
      //   }
      // ]
    },
    {
      path: '/test/Hi',
      name: 'Hi',
      component: Hi
    }
  ]
})
